import Vue from "vue";
import VueRouter from "vue-router";
import routes from './one.js';

Vue.use(VueRouter);
let router = new VueRouter({
    mode:'hash',
    routes
})

const paths = ['/home/stuInfoEntry','/home/stuInfoSelect',''];
router.beforeEach((to,from,next)=>{
    console.log(to)
    console.log(from)
    console.log(paths);
    if(paths.indexOf(to.path)>=0){
        console.log('111');
        if(Vue.store.state.user_name){
            next();
        }else{
            router.push('/login');
        }
    }else{
        next();
    }
})

export default router;

